package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.Device;
import com.dmpp.mes.parameterInfo.Order;
import com.dmpp.mes.service.DeviceService;
import com.dmpp.mes.service.OrderService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("Order")
public class OrderController {
    //订单管理
    @Autowired
    private OrderService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize, Order order) {
        PageHelper.startPage(page, pageSize);
        return service.findAll(order);
    }

    @RequestMapping(value = "/FindByOrderNo", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findByOrderNo(String orderNo) {
        return service.findByOrderNo(orderNo);
    }

    @RequestMapping(value = "/UpdateById", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateById(Order order) {
        return service.updateById(order);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(Order order) {
        return service.insert(order);
    }

    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData delete(String orderNo) {
        return service.delete(orderNo);
    }

}
